﻿using System;
using System.Collections.Generic;
using System.Web;
using DataAccess;
using System.Data;

/// <summary>
/// Summary description for AdmissionBS
/// </summary>
public class AdmissionBS
{
    AdmissionDAO adm;
    public AdmissionBS()
    {
        adm = new AdmissionDAO();
        //
        // TODO: Add constructor logic here
        //
    }
    // đăng kí học của sinh viên 
    public void AddAdmission(int CodeProfileStudent, int CodeSchoolSubjects, int CodeSchoolofYear, int CodeSemester, string CodeFaculty, string FullName, string DateOfBirth, string Gender, string FatherName, string MotherName, string ResidentalAddress, string PernamentAddress)
    {
        adm.AddAdmission(CodeProfileStudent, CodeSchoolSubjects, CodeSchoolofYear, CodeSemester, CodeFaculty, FullName, DateOfBirth, Gender, FatherName, MotherName, ResidentalAddress, PernamentAddress);
    }
    // admin duyệt đơn
    public void CheckAdmissionYes(int CodeSchoolSubjects, int CodeProfileStudent)
    {
        adm.CheckAdmissionYes(CodeSchoolSubjects, CodeProfileStudent);
    }
    public void CheckAdmissionNo(int CodeSchoolSubjects, int CodeProfileStudent)
    {
        adm.CheckAdmissionNo(CodeSchoolSubjects, CodeProfileStudent);
    }
    public void CheckAdmissionWait(int CodeSchoolSubjects, int CodeProfileStudent)
    {
        adm.CheckAdmissionWait(CodeSchoolSubjects, CodeProfileStudent);
    }
    // sinh viên đồng ý vào nhập học
    public void Status(int CodeSchoolSubjects, int CodeProfileStudent)
    {
        adm.Status(CodeSchoolSubjects, CodeProfileStudent);
    }
    //
    public List<Admission> ViewAdmissionSubject(int CodeSchoolSubjects)
    {
        DataTable tbl = adm.ViewAdmissionSubject(CodeSchoolSubjects);
        List<Admission> list = new List<Admission>();
        foreach (DataRow row in tbl.Rows)
        {
            Admission ad = new Admission(int.Parse(row[0].ToString()), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString(), row[6].ToString(), row[7].ToString(), row[8].ToString(), row[9].ToString(), row[10].ToString(), row[11].ToString(), bool.Parse(row[12].ToString()), row[13].ToString());
            list.Add(ad);
        }
        return list;
    }
    public List<Admission> ViewAdmission()
    {
        DataTable tbl = adm.ViewAdmission();
        List<Admission> list = new List<Admission>();
        foreach (DataRow row in tbl.Rows)
        {
            Admission ad = new Admission(int.Parse(row[0].ToString()), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString(), row[6].ToString(), row[7].ToString(), row[8].ToString(), row[9].ToString(), row[10].ToString(), row[11].ToString(), bool.Parse(row[12].ToString()), row[13].ToString());
            list.Add(ad);
        }
        return list;
    }
    public List<Admission> ListAdmission(int codestudent)
    {
        DataTable tbl = adm.ListAdmissionFalse(codestudent);
        List<Admission> list = new List<Admission>();
        foreach (DataRow row in tbl.Rows)
        {
            Admission ad = new Admission(int.Parse(row[0].ToString()), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString());
            list.Add(ad);
        }
        return list;
    }
    public List<Admission> ListAdmissionTrue(int codestudent)
    {
        DataTable tbl = adm.ListAdmissionTrue(codestudent);
        List<Admission> list = new List<Admission>();
        foreach (DataRow row in tbl.Rows)
        {
            Admission ad = new Admission(int.Parse(row[0].ToString()), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString());
            list.Add(ad);
        }
        return list;
    }
    public string StatusShow(int CodeSchoolSubjects, int CodeProfileStudent)
    {
        string status;
        status = adm.StatusShow(CodeSchoolSubjects, CodeProfileStudent);
        return status;
    }

}